package org.example;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.example.entiy.Student;

import javax.xml.namespace.QName;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class Myapp {
    public static void main(String[] args) throws IOException {
        String confing="mybatis.xml";
        InputStream input= Resources.getResourceAsStream(confing);
        SqlSessionFactoryBuilder sql=new SqlSessionFactoryBuilder();
        SqlSessionFactory factory=sql.build(input);
        SqlSession sqlSession=factory.openSession();
        String sqlId="org.example.dao.studentDao.studentDao";
        List<Student> students=sqlSession.selectList(sqlId);
        /*for(Student stu : students){
            System.out.println(stu);
        }*/

        students.forEach(student -> System.out.println(student));


        sqlSession.close();
    }



}
